/* Replication file for "Understanding Ambivalent Sexism and its Relationship with Electoral Choice in Britain"

Date: 24 August 2021
Any issues email: roosmarijndegeus@gmail.com 

EPOP DATA
Collected December 2019 by YouGov through funding from the Elections, Public Opinion and Parties section of the Political Studies Association


*/ 

*===========================================
* EPOP data 
*===========================================

use "/Users/roosmarijndegeus/Dropbox (Personal)/Roos-Collaborations/Ambivalent sexism/Britain survey/epop_yougov_vote.dta"



/*rename variables*/
rename Q1_SH innocent
rename Q2_SH control
rename Q3_SH cherished
rename Q4_SH purity

alpha innocent control
alpha cherished purity
alpha innocent control cherished purity 

/*create scales - positive values = sexist*/
recode innocent (5=-2) (4=-1) (3=0) (2=1) (1=2), gen(innocent2)
recode control (5=-2) (4=-1) (3=0) (2=1) (1=2), gen(control2)
recode cherished (5=-2) (4=-1) (3=0) (2=1) (1=2), gen(cherished2)
recode purity (5=-2) (4=-1) (3=0) (2=1) (1=2), gen(purity2)

egen hostile = rowtotal(innocent2 control2), missing
egen benevolent = rowtotal(cherished2 purity2), missing

gen hostile_rescale = hostile/4
gen benevolent_rescale = benevolent/4

/* distribution */ 
* Figure B1 
tab hostile_rescale [iw=W8]
tab benevolent_rescale [iw=W8]

label define sexist_label 0 "neither" -1 "not sexist" 1 "sexist"
gen sexist_h = 1 if hostile_rescale > 0 
replace sexist_h = -1 if hostile_rescale < 0 
replace sexist_h = 0 if hostile_rescale == 0 
replace sexist_h = . if hostile_rescale == . 
label values sexist_h sexist_label 


gen sexist_b = 1 if benevolent_rescale > 0 
replace sexist_b = -1 if benevolent_rescale < 0 
replace sexist_b = 0 if benevolent_rescale == 0 
replace sexist_b = . if benevolent_rescale == . 
label values sexist_b sexist_label 

* Table B2 
tabulate   sexist_b sexist_h [iw=W8] , cell


/*descriptive OLS*/
gen euvote2 = 1 if pastvote_EURef==2
replace euvote2 = 0 if pastvote_EURef==1
label define eulab2 0 "Remain" 1 "Leave"
label values euvote2 eulab2

gen labcon = 1 if recalled_2019_vote==1
replace labcon = 0 if recalled_2019_vote==2
label define labconlab 0 "Labour" 1 "Conservative"
label values labcon labconlab

estimates clear 
regress hostile_rescale i.profile_gender [iweight=W8]
estimates store m1
regress benevolent_rescale i.profile_gender [iweight=W8]
estimates store m2
regress hostile_rescale i.labcon [iweight=W8]
estimates store m3
regress benevolent_rescale i.labcon [iweight=W8]
estimates store m4
regress hostile_rescale i.euvote2 [iweight=W8]
estimates store m5
regress benevolent_rescale i.euvote2 [iweight=W8]
estimates store m6

* Table B3
esttab m1 m2 m3 m4 m5 m6 using "epop_groups.rtf", b(2) se nobase label replace 


* Sexist on both (vote2019 code below)
tab profile_gender if sexist_h == 1 & sexist_b == 1 [iw=W8]
tab vote2019 if sexist_h == 1 & sexist_b == 1 [iw=W8]
tab euvote2 if sexist_h == 1 & sexist_b == 1 [iw=W8]
mean (age) if  sexist_h == 1 & sexist_b == 1 [iw=W8]

* Sexist on neither
tab profile_gender if sexist_h == -1 & sexist_b == -1 [iw=W8]
tab vote2019 if sexist_h == -1 & sexist_b == -1 [iw=W8]
tab euvote2 if sexist_h == -1 & sexist_b == -1 [iw=W8]
mean (age) if  sexist_h == -1 & sexist_b == -1 [iw=W8]

* hostile but not benevolent
tab profile_gender if sexist_h == 1 & sexist_b == -1 [iw=W8]
tab vote2019 if sexist_h == 1 & sexist_b == -1 [iw=W8]
tab euvote2 if sexist_h == 1 & sexist_b == -1 [iw=W8]
mean (age) if  sexist_h == 1 & sexist_b == -1 [iw=W8]

* benevolent but not hostile 
tab profile_gender if sexist_h == -1 & sexist_b == 1 [iw=W8]
tab vote2019 if sexist_h == -1 & sexist_b == 1 [iw=W8]
tab euvote2 if sexist_h == -1 & sexist_b == 1 [iw=W8]
mean (age) if  sexist_h == -1 & sexist_b == 1 [iw=W8]



/*predicting sexism Table B4*/ 
** education
gen educ = 1 if profile_education_level>=1&profile_education_level<=8
replace educ = 2 if profile_education_level>=9&profile_education_level<=10
replace educ = 3 if profile_education_level>=11&profile_education_level<=12
replace educ = 4 if profile_education_level>=13&profile_education_level<=15
replace educ = 5 if profile_education_level>=16&profile_education_level<=17
replace educ = 6 if profile_education_level==18
replace educ = . if profile_education_level>=19&profile_education_level<=20
label define educlab 1 "below GCSE" 2 "GCSE or equivalent" 3 "A-level or equivalent" 4 "Further education" ///
	5 "Higher education" 6 "Other" 7 "missing"
label values educ educlab

** occupational class 
** combine together other (165) and never worked (44), and foreman/supervisor (29) with skilled manual (97)
recode profile_work_type (1=1 "Professional or higher technical") (2=2 "Manager or Senior Administrator") ///
	(3=3 "Clerical") (4=4 "Sales or Services") (5 6=5 "Foreman/Skilled manual") (7=6 "Semi-skilled or unskilled") ///
	(8 9=7 "Other/never worked"), gen(occ_class)
	
** age dummies 
gen age_dummy = . 
replace age_dummy = 1 if age >= 18 & age <= 25
replace age_dummy = 2 if age > 25 & age <= 45
replace age_dummy = 3 if age > 45 & age <= 65
replace age_dummy = 4 if age > 65
replace age_dummy = . if age == .

label define age_dummy_label 1 "18-25" 2 "25-45" 3 "45-65" 4 "65+"
label values age_dummy age_dummy_label 

* past vote as proxy for bundle of attitudes 
gen past_vote = . 
replace past_vote = 1 if pastvote_2017 == 1
replace past_vote = 2 if pastvote_2017 == 2
replace past_vote = 3 if pastvote_2017 == 3
replace past_vote = 4 if pastvote_2017 == 4 | pastvote_2017 == 5
replace past_vote = 5 if pastvote_2017 == 6 
replace past_vote = 6 if pastvote_2017 == 7

label define pastvotelabel 1 "Conservative" 2 "Labour" 3 "LibDem" 4 "SNP or Plaid" 5 "UKIP" 6 "Green"
label values past_vote pastvotelabel 

* Regression Model - Hostile
estimates clear 
regress hostile_rescale i.profile_gender if age_dummy!=. &educ!=.&occ_class!=.&profile_work_stat!=.& profile_marital_stat!=. & past_vote != . [iweight=W8]
estimates store m1 

regress hostile_rescale i.profile_gender i.age_dummy i.educ i.occ_class i.profile_work_stat i.profile_marital_stat if past_vote != . [iweight=W8]
estimates store m2 

regress hostile_rescale i.profile_gender i.age_dummy i.educ i.occ_class i.profile_work_stat i.profile_marital_stat i.past_vote [iweight=W8]
estimates store m3 

* Regression Model - Benevolent
regress benevolent_rescale i.profile_gender if age_dummy!=. &educ!=.&occ_class!=.&profile_work_stat!=.&profile_marital_stat!=. & past_vote != . [iweight=W8]
estimates store m4

regress benevolent_rescale i.profile_gender i.age_dummy i.educ i.occ_class i.profile_work_stat i.profile_marital_stat if past_vote != . [iweight=W8]
estimates store m5

regress benevolent_rescale i.profile_gender i.age_dummy i.educ i.occ_class i.profile_work_stat i.profile_marital_stat i.past_vote [iweight=W8]
estimates store m6 


esttab m1 m2 m3 m4 m5 m6 using "epop_predict.rtf", b(2) se nobase label replace 

* Age distribution - Figure B2
histogram hostile_rescale, discrete percent by(age_dummy)
histogram benevolent_rescale, discrete percent by(age_dummy)



* EU referendum vote - Table B5 
* control for 2015 vote 
gen vote2015 = . 
replace vote2015 = 1 if pastvote_2015_recode == 1 
replace vote2015 = 2 if pastvote_2015_recode == 2
replace vote2015 = 3 if pastvote_2015_recode == 3
replace vote2015 = 4 if pastvote_2015_recode == 4 | pastvote_2015_recode == 5
replace vote2015 = 5 if pastvote_2015_recode == 6 | pastvote_2015_recode == 8
replace vote2015 = 6 if pastvote_2015_recode == 7

label define votelabel2 1 "Conservative" 2 "Labour" 3 "LibDem" 4 "SNP or Plaid" 5 "UKIP or BNP" 6 "Green"
label values vote2015 votelabel2



estimates clear 
regress euvote2 hostile_rescale benevolent_rescale if profile_gender != . &  age_dummy!=. &educ!=.&occ_class!=.&profile_work_stat!=.& profile_marital_stat!=. & vote2015 != . [iweight=W8]
estimates store m1 

regress euvote2 hostile_rescale benevolent_rescale i.profile_gender i.age_dummy i.educ i.occ_class i.profile_work_stat i.profile_marital_stat if vote2015 != . [iweight=W8]
estimates store m2 

regress euvote2 hostile_rescale benevolent_rescale i.profile_gender i.age_dummy i.educ i.occ_class i.profile_work_stat i.profile_marital_stat i.vote2015 [iweight=W8]
estimates store m3

esttab m1 m2 m3 using "epop_euref.rtf", b(2) se nobase label replace 

* 2019 Vote - Table B6
gen vote2019 = . 
replace vote2019 = 1 if recalled_2019_vote == 1
replace vote2019 = 2 if recalled_2019_vote == 2
replace vote2019 = 3 if recalled_2019_vote == 3 
replace vote2019 = 4 if recalled_2019_vote == 4 | recalled_2019_vote == 5
replace vote2019 = 5 if recalled_2019_vote == 6
replace vote2019 = 6 if recalled_2019_vote == 7
label values vote2019 pastvotelabel

gen convote = . 
replace convote = 1 if recalled_2019_vote == 1
replace convote = 0 if recalled_2019_vote != 1 & recalled_2019_vote != . & recalled_2019_vote != 9 

estimates clear 
logit convote hostile_rescale benevolent_rescale if profile_gender != . &  age_dummy!=. &educ!=.&occ_class!=.&profile_work_stat!=.& profile_marital_stat!=. & euvote2 != . [iweight=W8]
estimates store m1 

logit convote hostile_rescale benevolent_rescale i.profile_gender i.age_dummy i.educ i.occ_class i.profile_work_stat i.profile_marital_stat if euvote2 != . [iweight=W8]
estimates store m2 

logit convote  hostile_rescale benevolent_rescale i.profile_gender i.age_dummy i.educ i.occ_class i.profile_work_stat i.profile_marital_stat i.euvote2 [iweight=W8]
estimates store m3

esttab m1 m2 m3 using "epop_votege.rtf", b(2) se nobase label replace 

